package qlsl.androiddesign.view.subview.activityview;

import com.qlsl.androiddesign.kuaiwa.R;

import android.view.View;
import android.widget.BaseAdapter;
import qlsl.androiddesign.activity.subactivity.CollectionActivity;
import qlsl.androiddesign.adapter.subadapter.CollectionAdapter;
import qlsl.androiddesign.entity.otherentity.ShoppingDetail;
import qlsl.androiddesign.http.service.commonservice.MemberService;
import qlsl.androiddesign.view.subview.activityview.peoplecenterbase.PeopleCenterBaseView;

/**
 * 收藏页<br/>
 * 需要传入的键：<br/>
 * 传入的值类型： <br/>
 * 传入的值含义：<br/>
 * 是否必传 ：
 */
public class CollectionView extends PeopleCenterBaseView<ShoppingDetail, CollectionActivity> {

	public CollectionView(CollectionActivity activity) {
		super(activity);
	}

	protected void initView(View view) {
		super.initView(view);
		setTitle("我的收藏");
	}

	protected void initData() {
		super.initData();
		MemberService.queryCollectList(1, this, activity);
	}

	protected void initListener() {
		super.initListener();
	}

	public void onClick(View view) {
		switch (view.getId()) {
		case R.id.btn_cancel:
			doClickCancelView(view);
			break;
		}
	}

	private void doClickCancelView(View view) {
		int position = refreshView.getRefreshableView().getPositionForView(view);
		ShoppingDetail item = (ShoppingDetail) refreshView.getAdapter().getItem(position);
		MemberService.cancelCollect(item.getGoodsid(), this, activity);
	}

	public BaseAdapter getAdapter() {
		return new CollectionAdapter(activity, list);
	}

}
